package com.esri.core.internal.tasks.ags;

import com.esri.core.internal.tasks.TaskListener;
import com.esri.core.io.UserCredentials;
import com.esri.core.portal.PortalItem;
import java.util.ArrayList;
import java.util.List;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonToken;

/* loaded from: classes.dex */
public class y extends com.esri.core.internal.tasks.d<List<PortalItem>> {
    private static final long serialVersionUID = 1;

    public y(al alVar, String str, UserCredentials userCredentials) {
        super(alVar, str, userCredentials);
    }

    public y(al alVar, String str, UserCredentials userCredentials, TaskListener<List<PortalItem>> taskListener) {
        super(alVar, str, userCredentials, taskListener);
    }

    @Override // com.esri.core.internal.tasks.a
    /* renamed from: a */
    public List<PortalItem> execute() throws Exception {
        ArrayList arrayList = new ArrayList();
        JsonParser a = com.esri.core.internal.io.handler.h.a(this.serviceURL, getActionInput().generateRequestParams(), getServiceCredentials());
        if (com.esri.core.internal.util.d.c(a)) {
            while (a.nextToken() != JsonToken.END_OBJECT) {
                String currentName = a.getCurrentName();
                a.nextToken();
                if (currentName.equals("items")) {
                    while (a.nextToken() != JsonToken.END_ARRAY) {
                        arrayList.add(PortalItem.fromJson(a, ((al) getActionInput()).a));
                    }
                }
            }
            return arrayList;
        }
        return null;
    }
}
